<? session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="../../Inc/Css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<p>当前位置：模板管理&gt;编辑模板页面</p>
<p>
  <?
 
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/"."inc/ActionFile.Class.php";

if($_SESSION["Login"][1]<>$SystemConest[2])
{
	die("你不是超级管理员,没有权限设置");
}
$myfile=new  ActionFile();
//==================================================当为修改操作时
$action =$_REQUEST["action"];
$path==$_REQUEST["path"];
if($action=="edit")
{
	
	$myfile->CreatFile($_REQUEST["dir"].$_REQUEST["filename"],$myfile->turnWrite($_REQUEST["content"]));
	MessgBox("/".$SystemConest[1]."/Iamges/Right.jpg","修改成功！","/".$SystemConest[1]."/system/template") ;	
	die; 
}


if($action!="add")
{
	$file=$_REQUEST["file"];
	if(!is_file($SystemConest[0].$file))
	{
		if(is_dir($SystemConest[0].$file))
		{
			//转入相关文件夹下
			
			gourl("list.php?path=".$file."",1);
		}
		else
		{
			die("这不是一个正确的文件");
		}
		
	};
	$filename=explode("/",$file);
	$content=$myfile->turnRead($myfile->readFileContent($SystemConest[0].$file,"1"));
	$dir=str_replace($filename[count($filename)-1],"",$file);
}
else
{
	$dir=$_REQUEST["dir"];
}
?>

<table width="73%" border="0" cellspacing="0" cellpadding="0" align="center">
  <form action="editfilecode.php?action=edit" method="post"><tr>
    <td width="21%" height="32">文件名：</td>
    <td width="79%"><input name="filename" type="text" value="<? echo $filename[count($filename)-1];?>">&nbsp;<input type="hidden" value="<? echo $dir;?>" name="dir"></td>
  </tr>
  <tr>
    <td height="169">内容</td>
    <td>
      <textarea name="content" id="content" cols="80" rows="20"><? echo $content;?></textarea>
    </td>
  </tr>
  <tr>
    <td height="25">&nbsp;</td>
    <td height="25"><label>
      <input type="submit" name="button" id="button" value="修改" />
    </label></td>
  </tr>
  </form>
</table>
</body>
</html>